#include "mainwindow.h"

#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include <chessdata.h>
#include <firstdialog.h>




int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator translator;
    const QStringList uiLanguages = QLocale::system().uiLanguages();
    for (const QString &locale : uiLanguages) {
        const QString baseName = "xiangqi_" + QLocale(locale).name();
        if (translator.load(":/i18n/" + baseName)) {
            a.installTranslator(&translator);
            break;
        }
    }
    FirstDialog fd;
    MainWindow w;

    fd.connectToMainWindow(w);


    fd.setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
    //fd.setAttribute(Qt::WA_DeleteOnClose, false);
    fd.setWindowFlags(fd.windowFlags() & ~Qt::WindowCloseButtonHint);
    fd.raise();
    w.lower();
    w.show();
    fd.show();

    return a.exec();
}
